package com.appbee.cm.server.dataservice;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Provider;

import com.appbee.cm.server.data.ActivityEntry;
import com.appbee.cm.server.data.ActivityEntryDAO;
import com.appbee.cm.server.data.NavItem;
import com.appbee.cm.server.data.NavItemDAO;
import com.appbee.user.server.dao.UserControl;
import com.appbee.user.server.model.WebUser;

public class DataService
{
	private final Provider<UserControl> userControlProvider;
	private final Provider<NavItemDAO> navItemDaoProvider;
	private final Provider<ActivityEntryDAO> activityEntryDaoProvider;

	@Inject
	public DataService(Provider<UserControl> userControlProvider,Provider<NavItemDAO> navItemDaoProvider,Provider<ActivityEntryDAO> activityEntryDaoProvider)
	{
		this.userControlProvider = userControlProvider;
		this.navItemDaoProvider = navItemDaoProvider;
		this.activityEntryDaoProvider = activityEntryDaoProvider;

	}

	public List<NavItem> findNavItems()
	{
		return navItemDaoProvider.get().findAll();
	}

	public List<ActivityEntry> findActivityEntries()
	{
		return activityEntryDaoProvider.get().findAll();
	}

	public WebUser getCurrentUser(String destinationURL)
	{
		return userControlProvider.get().getCurrentUser(destinationURL);
	}
}
